package com.xiaoxin.project.system.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaoxin.framework.aspectj.lang.annotation.DataSource;
import com.xiaoxin.framework.aspectj.lang.enums.DataSourceType;
import com.xiaoxin.framework.web.page.PageDomain;
import com.xiaoxin.framework.web.page.PageUtils;
import com.xiaoxin.framework.web.page.TableSupport;
import com.xiaoxin.project.system.domain.ExDeviceInfo;
import com.xiaoxin.project.system.domain.SysUser;
import com.xiaoxin.project.system.mapper.ExDeviceInfoMapper;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExDeviceInfoServiceImpl extends ServiceImpl<ExDeviceInfoMapper, ExDeviceInfo> {
    @DataSource(value = DataSourceType.SLAVE)
    public List<ExDeviceInfo> getExList() {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        //Page<SysUser> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
        PageUtils.startPage();
        List<ExDeviceInfo> allList = baseMapper.getExList();
        //List<ExDeviceInfo> allList = baseMapper.getExList(page);
        return allList;
    }
    @DataSource(value = DataSourceType.SLAVE)
    public List<ExDeviceInfo> getExList2() {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Page<ExDeviceInfo> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
        List<ExDeviceInfo> allList = baseMapper.getExList(page);
        return allList;
    }
}
